package com.wey.springboot.controller;

import com.wey.springboot.service.GradeService;
import com.wey.springboot.util.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@ResponseBody
@RestController
public class GradeController {
  @Autowired
  GradeService gradeService;

  @GetMapping("/grade/list")
  public CommonResult<List<Map<String, Object>>> list(@RequestParam Map<String, Object> map) {
    return CommonResult.success(gradeService.listMaps(map));
  }

  @GetMapping("/grade/search")
  public CommonResult<List<Map<String, Object>>> getGrades(@RequestParam("id") Integer id) {
    return CommonResult.success(gradeService.searchGrdes(id));
  }

  @GetMapping("/grade/detail")
  public CommonResult<List<Map<String, Object>>> detail() {
    return CommonResult.success(gradeService.detail());
  }
}
